package com.ChenYaRou.www.dao;

import com.ChenYaRou.www.po.DetailedUser;

import java.sql.SQLException;

/**
 * @author 86183
 */
public interface DetailedUserDao {
    /**
     * 搜索
     * @param userId 用户的id
     * @return user的详细信息
     * @throws SQLException
     * @throws  NoSuchFieldException
     * @throws InstantiationException
     * @throws  IllegalAccessException
     */
    DetailedUser select(Integer userId) throws SQLException, NoSuchFieldException,
            InstantiationException, IllegalAccessException;

    /**
     * 插入
     * @param detailedUser detailedUser
     * @return 成功与否(>0成功 0 false)
     * @throws  IllegalAccessException
     * @throws SQLException
     */
    int insert(DetailedUser detailedUser) throws IllegalAccessException, SQLException;

    /**
     * 更新user
     * @param newDetailedUser 存放更新值的user
     * @param oldDetailedUser 旧的detailUser 其实只需要用到其中的userId
     * @return 更新条数
     * @throws IllegalAccessException 非法访问
     * @throws SQLException sql异常
     */
    int update(DetailedUser newDetailedUser,DetailedUser oldDetailedUser) throws IllegalAccessException, SQLException;
}
